.\" man page for sntpd and Larry Doolittle's ntpclient
.\" distributed under GPL
.\" originally written by Walter Harms
.Dd Mar 8, 2020
.\" Please adjust this date whenever revising the manpage.
.Dt SNTPD 8
.Sh NAME
.Nm sntpd
.Nd Simple NTP daemon and client
.Sh SYNOPSIS
.Nm
.Op Fl dhnrstv
.Op Fl i Ar SEC
.Op Fl p Ar PORT
.Op Fl q Ar USEC
.Op SERVER
.Nm ntpclient
.Op Fl dlrst
.Op Fl c Ar count
.Op Fl f Ar frequency
.Op Fl g Ar goodness
.Op Fl h Ar hostname
.Op Fl i Ar interval
.Op Fl p Ar port
.Op Fl q Ar min_delay
.Sh DESCRIPTION
.Nm
is an NTP (RFC-1305) client and server for UNIX-alike computers.  Its
functionality is a small subset of xntpd, but has the potential to
function better within that limited scope.  Since it is much smaller
than xntpd, it is also more relevant for embedded computers.  It
daemonizes itself by default and starts synchronizing with the given NTP
server, or pool.ntp.org if no server is given, using default settings.
.Pp
.Nm
has a very limited server mode, by default listening on UDP port 123 for
client connections.  The intention of this mode is to serve time from a
central router to small subnets where routing is not desired.  Similar
to a DHCP relay agent.
.Pp
.Nm
is a multicall binary.  When started as
.Nm ntpclient
it runs in a compatibility mode with the original by Larry Doolittle and
produces output similar to this:
.Bd -unfilled -offset indent
Day    Second     Elapsed   Stall  Skew      Dispersion  Freq
36765  00180.386  1398.0    40.3   953773.9  793.5       -1240000
36765  00780.382  1358.0    41.3   954329.0  915.5       -1240000
36765  01380.381  1439.0    56.0   954871.3  915.5       -1240000
.Ed
.Pp
The columns have the following meaning:
.Pp
.Bl -tag -width DaysSeconds -compact -offset indent
.It Cm Day, Second
Time of measurement, UTC, relative to NTP epoch (Jan 1, 1900)
.It Cm Elapsed
Total time from query to response (microseconds)
.It Cm Stall
Time the server reports that it sat on the request (microseconds)
.It Cm Skew
Difference between local time and server time (microseconds)
.It Cm Dispersion
Reported by server, see RFC-1305 (microseconds)
.It Cm Freq
Local clock frequency adjustment (Linux only, ppm*65536)
.El
.Sh OPTIONS
The following options are supported by
.Nm
only.  See the
.Sx SYNOPSIS
section for available options for the
.Nm ntpclient
compat mode.  Note, if the
.Ar SERVER
argument is omitted,
.Nm
defaults to use pool.ntp.org.  This is also the most prominent
difference to
.Nm ntpclient
which requires a server hostname to be given as argument.
.Bl -tag -width Ds
.It Fl d
Dry run, no time correction, useful for debugging.
.It Fl h
Show summary of command line options and exit.
.It Fl i Ar SEC
Check time every interval seconds, default 600.
.It Fl l Ar LEVEL
Set log level for syslog messages:
.Pp
.Bl -tag -width WARNING -compact -offset indent
.It Cm none
Disable all logging
.It Cm error
Error conditions
.It Cm warning
Warning conditions
.It Cm notice
Normal but significant condition (default)
.It Cm info
Informational, all time sync events
.It Cm debug
Debug-level messages, like
.Cm info
but more, very noisy
.El
.It Fl n
Don't fork.  Prevents
.Nm
from daemonizing and also implies logging to stdout, use
.Fl s
to enable syslog in this mode.
.It Fl p Ar PORT
By default
.Nm
starts up its very limited server mode, prepared to serve clients with
time on UDP port 123.  This option can be used to change the server
listening port, or to disable the server mode, by setting port to zero
(0).
.It Fl q Ar USEC
Minimum packet delay for transaction, default 800 microseconds.
.It Fl r
Replay analysis code based on stdin, feature is disabled by default
at compile time.
.It Fl s
Use syslog instead of stdout for log messages, default unless started
with
.Fl n .
.It Fl t
Trust network and server, no RFC-4330 recommended cross-checks.
.It Fl v
Display
.Nm
version.
.El
.Sh AUTHORS
Larry Doolittle maintains the original
.Nm ntpclient,
.Lk http://doolittle.icarus.com/ntpclient/ upstream
.Pp
Joachim Nilsson maintains this
.Nm
fork at
.Lk https://github.com/troglobit/sntpd GitHub
.Sh COPYRIGHT
The
.Nm ntpclient
project is Copyright 1997-2015 Larry Doolittle, and Copyright 2010-2018
Joachim Nilsson.   The fork by Joachim was renamed
.Nm
in December 2018, but like its ancestor it can be freely copied,
modified and used according to the terms of the GNU General Public
License, version 2.
.Sh "SEE ALSO"
.Xr adjtimex 1 ,
.Lk http://www.ntp.org
